﻿using AutoMapper;
using Wy.JiZhangSoft.Dictionaries;
using Wy.JiZhangSoft.Dictionaries.Dtos;
using Wy.JiZhangSoft.ZhangDans;
using Wy.JiZhangSoft.ZhangDans.Dtos;

namespace Wy.JiZhangSoft
{
    public class JiZhangSoftApplicationAutoMapperProfile : Profile
    {
        public JiZhangSoftApplicationAutoMapperProfile()
        {
            /* You can configure your AutoMapper mapping configuration here.
             * Alternatively, you can split your mapping configurations
             * into multiple profile classes for a better organization. */
            CreateMap<ZhangDan, ZhangDanAddDto>().ReverseMap();
            CreateMap<ZhangDan, ZhangDanGetDto>().AfterMap((x,y)=> {
                y.Date = x.Date.ToString("yyyy-MM-dd");
            }).ReverseMap();
            CreateMap<ZhangDan, ZhangDanUpdateDto>().ReverseMap();
            CreateMap<Dictionary, DictionaryGetDto>().ReverseMap();
            CreateMap<Dictionary, DictionaryAddDto>().ReverseMap();
            CreateMap<LeiJiZhiChuStatisticGetDto, LeiJiZhiChuStatistics>().ReverseMap();
            CreateMap<MonthLatelyZhiChuStatistic, MonthStatisticGetDto >().AfterMap((x, y) => {
                y.Month = x.Year + "-" + x.Month;
            }).ReverseMap();
        }
    }
}
